package com.miguo.framework.web;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.webkit.DownloadListener;

import com.miguo.framework.utils.Log;

public class CustomDownloadListener implements DownloadListener {

	private Activity mActivity;

	public CustomDownloadListener(Activity activity) {
		super();
		mActivity = activity;
	}

	@Override
	public void onDownloadStart(String url, String userAgent,
			String contentDisposition, String mimetype, long contentLength) {
		try {
			Intent intent = new Intent("android.intent.action.VIEW",
					Uri.parse(url));
			mActivity.startActivity(intent);
		} catch (Exception e) {
			Log.e(e.getMessage());
		}
	}
}
